/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.edu.upc.dew.discoteca.dao;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.stereotype.Repository;
import pe.edu.upc.dew.discoteca.model.Persona;

/**
 *
 * @author elvis
 */
@Repository
public class UsuarioDAOImpl implements UsuarioDAO{

   private EntityManager em;

    @PersistenceContext
    public void setEntityManager(EntityManager em) {
	this.em = em;
    }

   public Persona obtenerPersona(String username) {
    return (Persona)em.createQuery("from Persona where usuario = :cod ").setParameter("cod", username).getSingleResult();
   }

}
